{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "b49bbb9f",
   "metadata": {},
   "source": [
    "# 本周知识点\n",
    "> 1. 用户输入\n",
    "> 2. 文本的格式化输出"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f9dc648c",
   "metadata": {},
   "source": [
    "# 1.用户输入\n",
    "##### .input方法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "09a70e69",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 用户登录系统\n",
    "username = input()\n",
    "password = input()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4aa02a96",
   "metadata": {},
   "outputs": [],
   "source": [
    "input(username)\n",
    "input(password)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "eb493742",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 用户登录系统 迭代1\n",
    "\n",
    "user01 = \"admin\"\n",
    "password01 = \"123456\"\n",
    "\n",
    "\n",
    "# 情景一：账号密码都正确\n",
    "if user01 == username and password01 == password:\n",
    "    print(\"登陆成功~欢迎\"+user01)\n",
    "else:\n",
    "    print(\"账号不存在或密码不正确！请重新输入！\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2ec290bd",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 用户登录系统 迭代2\n",
    "\n",
    "user01 = \"admin\"\n",
    "password01 = \"123456\"\n",
    "\n",
    "# 情景二：账号不存在或密码不正确，用户可输入三次，三次之后一小时之后再来尝试\n",
    "\n",
    "if user01 != username or password01 != password:\n",
    "    for i in  range(3):\n",
    "        username = input()\n",
    "        password = input()\n",
    "        if user01 == username and password01 == password:\n",
    "            print(\"登陆成功~欢迎\"+user01)\n",
    "        else:\n",
    "            if i>1:\n",
    "                print(\"\")\n",
    "            else:\n",
    "                print(\"\")\n",
    "            "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "498cc241",
   "metadata": {},
   "source": [
    "##  2.字符串的格式化输出\n",
    ">1. 字符串的拼接\n",
    ">2. 占位符\n",
    ">3. 格式化输出的方法：format()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d975094d",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 用户的信息输入（完善信息）:字符串的拼接\n",
    "name = input(\"昵称：\")\n",
    "region = input(\"地区：\")\n",
    "job = input(\"工作：\")\n",
    "age = input(\"年龄：\")\n",
    "salagy = input(\"期待薪资：\")\n",
    "\n",
    "infor ='''------INFO'''+name+'''-------\n",
    "地区：'''+ region +'''\n",
    "工作：'''+ job +'''\n",
    "年龄：'''+ age +'''\n",
    "期待薪资：'''+salary\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5e642dc8",
   "metadata": {},
   "outputs": [],
   "source": [
    "print(infor)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4769c59b",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 用户的信息输入（完善信息）:占位符 %s\n",
    "name = input(\"昵称：\")\n",
    "region = input(\"地区：\")\n",
    "job = input(\"工作：\")\n",
    "age = input(\"年龄：\")\n",
    "salagy = input(\"期待薪资：\")\n",
    "\n",
    "infor ='''------INFO s%-------\n",
    "地区：%s\n",
    "工作：%s\n",
    "年龄：%s\n",
    "期待薪: %s '''%(name,region,job,age,salary)\n",
    "print(into)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "59197b9c",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 用户的信息输入（完善信息）：format()\n",
    "name = input(\"昵称：\")\n",
    "region = input(\"地区：\")\n",
    "job = input(\"工作：\")\n",
    "age = input(\"年龄：\")\n",
    "salagy = input(\"期待薪资：\")\n",
    "\n",
    "infor ='''------INFO {昵称}-------\n",
    "地区：{地区}\n",
    "工作：{工作}\n",
    "年龄：{年龄}\n",
    "期待薪: {薪资} '''，format(工作职位=job,薪资=salary,昵称=name,年龄=age,地区=region)\n",
    "print(into)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
